<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="824.42">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
    p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
    p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
    p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
    p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
    p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300}
    p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}
    p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica; min-height: 16.0px}
    p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
    span.s1 {text-decoration: underline}
    span.s2 {color: #000000}
    span.s3 {color: #007300}
    span.s4 {color: #0000bf}
    span.Apple-tab-span {white-space:pre}
  </style>
</head>
<body>
<p class="p1"><b>Maxamp<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>tracks and prints amplitudes</b></p>
<p class="p2"><b></b><br></p>
<p class="p3"><b>Warning!!! Printing from the server is very expensive on the client side (lang).<span class="Apple-converted-space">  </span>This CPU usage will not show up in your CPU usage on the server side.<span class="Apple-converted-space"> </span></b></p>
<p class="p4"><b></b><br></p>
<p class="p5"><b>Maxamp.ar(in, numSamples)</b></p>
<p class="p6"><b></b><br></p>
<p class="p5"><b><span class="Apple-tab-span">	</span>in - the input you would like to track</b></p>
<p class="p5"><b><span class="Apple-tab-span">	</span>numSamples - the period in which Maxamp will post amp information</b></p>
<p class="p6"><b><span class="Apple-tab-span">	</span></b></p>
<p class="p3"><span class="s1"><b>Usage</b></span></p>
<p class="p7"><br></p>
<p class="p8">(</p>
<p class="p7"><br></p>
<p class="p9">SynthDef<span class="s2">(</span><span class="s3">\sample</span><span class="s2">, {</span>|dur|</p>
<p class="p8"><span class="Apple-tab-span">	</span><span class="s4">Out</span>.ar(0, <span class="s4">SinOsc</span>.ar(440, 0, <span class="s4">LFNoise1</span>.ar(0.5)) *<span class="Apple-converted-space"> </span></p>
<p class="p8"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s4">EnvGen</span>.kr(<span class="s4">Env</span>([0.01, 1, 1, 0.01], [0.01, dur - 0.02, 0.01]), doneAction: 2))</p>
<p class="p8"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p7"><span class="Apple-tab-span">	</span></p>
<p class="p7"><span class="Apple-tab-span">	</span></p>
<p class="p9">SynthDef<span class="s2">(</span><span class="s3">\maxamptest</span><span class="s2">, {</span>|inbus|</p>
<p class="p8"><span class="Apple-tab-span">	</span><span class="s4">Maxamp</span>.ar(<span class="s4">In</span>.ar(inbus, 1), <span class="s4">SampleRate</span>.ir / 10)</p>
<p class="p8"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p7"><span class="Apple-tab-span">	</span></p>
<p class="p8">)</p>
<p class="p7"><br></p>
<p class="p8">s.boot;</p>
<p class="p7"><br></p>
<p class="p8">s.sendBundle(0.1, [<span class="s3">\s_new</span>, <span class="s3">\sample</span>, -1, 0, 1, <span class="s3">\dur</span>, 4],</p>
<p class="p10"><span class="s2"><span class="Apple-tab-span">	</span></span>// run maxamp test at the tail of group 1</p>
<p class="p11"><span class="s2"><span class="Apple-tab-span">	</span>[</span>\s_new<span class="s2">, </span>\maxamptest<span class="s2">, -1, 1, 1, </span>\inbus<span class="s2">, 0]);</span></p>
<p class="p7"><span class="Apple-tab-span">	</span></p>
<p class="p10">// run a couple more synths</p>
<p class="p7"><br></p>
<p class="p8">s.sendBundle(0.1, [<span class="s3">\s_new</span>, <span class="s3">\sample</span>, -1, 0, 1, <span class="s3">\dur</span>, 2],</p>
<p class="p8"><span class="Apple-tab-span">	</span>[<span class="s3">\s_new</span>, <span class="s3">\sample</span>, -1, 0, 1, <span class="s3">\dur</span>, 3],</p>
<p class="p8"><span class="Apple-tab-span">	</span>[<span class="s3">\s_new</span>, <span class="s3">\sample</span>, -1, 0, 1, <span class="s3">\dur</span>, 4]);</p>
<p class="p7"><span class="Apple-tab-span">	</span></p>
<p class="p10">// kill maxamptest</p>
<p class="p7"><br></p>
<p class="p8">s.sendBundle(0.1, [<span class="s3">\g_freeAll</span>, 1]);</p>
<p class="p7"><br></p>
<p class="p5"><b>Here is a sample of what prints:</b></p>
<p class="p6"><b></b><br></p>
<p class="p8">Maxamp from 1.8 to 1.9: 0.87646, Overall Maxamp at 1.89903: 0.87646</p>
<p class="p8">Maxamp from 1.9 to 2: 0.930082, Overall Maxamp at 1.999: 0.930082</p>
<p class="p8">Maxamp from 2 to 2.1: 0.930123, Overall Maxamp at 2.00011: 0.930123</p>
<p class="p8">Maxamp from 2.1 to 2.2: 0.88386, Overall Maxamp at 2.00011: 0.930123</p>
<p class="p8">Maxamp from 2.2 to 2.3: 0.837598, Overall Maxamp at 2.00011: 0.930123</p>
<p class="p8">Maxamp from 2.3 to 2.4: 0.791335, Overall Maxamp at 2.00011: 0.930123</p>
<p class="p7"><br></p>
<p class="p5">The last line shows that the Maxamp from 2.3 - 2.4 seconds was 0.791335.<span class="Apple-converted-space">  </span>The overall Maxamp occurred at 2.00011 seconds, with a value of 0.930123.</p>
<p class="p4"><b></b><br></p>
<p class="p3"><b>For NRT</b></p>
<p class="p4"><b></b><br></p>
<p class="p12">This UGen can be particularly useful during NRT synthesis:</p>
<p class="p13"><br></p>
<p class="p8">a = [</p>
<p class="p8"><span class="Apple-tab-span">	</span>[0, [<span class="s3">\g_new</span>, 1], [<span class="s3">\s_new</span>, <span class="s3">\sample</span>, -1, 0, 1, <span class="s3">\dur</span>, 4], [<span class="s3">\s_new</span>, <span class="s3">\maxamptest</span>, -1, 1, 1]],</p>
<p class="p8"><span class="Apple-tab-span">	</span>[6, [<span class="s3">\s_new</span>, <span class="s3">\sample</span>, -1, 0, 1, <span class="s3">\dur</span>, 2]],</p>
<p class="p8"><span class="Apple-tab-span">	</span>[8, [<span class="s3">\s_new</span>, <span class="s3">\sample</span>, -1, 0, 1, <span class="s3">\dur</span>, 3]],</p>
<p class="p8"><span class="Apple-tab-span">	</span>[11, [<span class="s3">\c_set</span>, 0, 0]]</p>
<p class="p8"><span class="Apple-tab-span">	</span>]</p>
<p class="p7"><br></p>
<p class="p10">// make sure the local server is not booted</p>
<p class="p7"><span class="Apple-tab-span">	</span></p>
<p class="p14"><span class="s4">Score</span><span class="s2">.recordNRT(a, </span>"/tmp/sc.sc"<span class="s2">, </span>"test.aiff"<span class="s2">);</span></p>
<p class="p7"><br></p>
<p class="p13"><span class="Apple-tab-span">	</span></p>
</body>
</html>
